//
//  ViewController.m
//  AlertView
//
//  Created by dyy on 2018/1/19.
//  Copyright © 2018年 dyy. All rights reserved.
//

#import "ViewController.h"
#import "DXAlertView.h"
#define kUserDefaults [NSUserDefaults standardUserDefaults]
@interface ViewController ()<DXAlertViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
#pragma mark -- DXAlertViewDelegate
- (void)dxAlertView:(DXAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSString *firstClickStr = [kUserDefaults valueForKey:@"firstClick"];
    if (buttonIndex == 1) {
        if(firstClickStr){
    
        }else{
            [kUserDefaults setObject:@"clicked" forKey:@"firstClick"];
        }
 
    }
    
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    DXAlertView *alertView = [[DXAlertView alloc] initWithTitle:@"提示" message:@"是否给该篇文章30赞值?" cancelBtnTitle:@"否" otherBtnTitle:@"是(仅此一次)"];
    alertView.delegate = self;
    [alertView show];
    NSLog(@"合并到主枝干");
    NSLog(@"同步");

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
